package com.cya.cyaproducts;

import java.util.ArrayList;

public class Model {

    public static ArrayList<Item> Items;

    public static void LoadModel(int currentPage) {

        Items = new ArrayList<Item>();
        
        String result_string = Crawler.getInstance().getListProducts(currentPage);
        Items = LibJsonParse.getListProducts(result_string);

    }

    public static Item GetbyId(int id){

        for(Item item : Items) {
            if (item.Id == id) {
                return item;
            }
        }
        return null;
    }

}
